home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_toolbx.arc / DOS2CALL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-30  |  911 b   |  28 lines

  1. /*  dos2call.c - does dos 2.0 calls checking carry flag on return */
  2. #include   "stdio.h"
  3. #include   "cminor.h"
  4. #include   "asmtools.h"
  5.  
  6. unsigned dos_err ;        /* record error code here */
  7. unsigned dos_flags ;        /* and flags here */
  8.  
  9. dos2call(fun_no,pin,pout)        /* do a DOS function call */
  10.   int    fun_no ;            /* function number */
  11.   REGS    *pin   ;            /* points to input reg. structure */
  12.   REGS    *pout  ;            /* points to output reg. structure */
  13.   {
  14.                     /* set up function code in AH */
  15.      ( (BYTE_REGS *) pin) ->ah = fun_no ;
  16.      dos_flags = swint(DOS_CALL,pin,pout) ;    /* do the DOS call */
  17.      if( ( dos_flags&CF_FLAG) != 0 )    /* check for an error return */
  18.     {  dos_err = pout->ax ;     /* yes - record error value  */
  19.        return( -1 ) ;        /*     and return error value */
  20.     }
  21.      else
  22.     {  dos_err = 0 ;        /* no error - clear error code */
  23.        return( 0 ) ;        /*    return normal value */
  24.     }
  25.   }
  26.  
  27.  
  28.